#include "WorkerLss.h"

WorkerLss::WorkerLss(int rank, int numThreads, bool debug){
	this->setRank(rank);
	this->setNumThreads(numThreads);
	
	this->setDebug(debug);
}

WorkerLss::~WorkerLss(){
}

int WorkerLss::getRank(void){
	return this->rank;
}

void WorkerLss::setRank(int rank){
	if(rank > -1){
		this->rank = rank;
	} else {
		this->rank = 1;
	}
	
	return;
}

int WorkerLss::getNumThreads(void){
	return this->numThreads;
}

void WorkerLss::setNumThreads(int numThreads){
	if(numThreads > 1){
		this->numThreads = numThreads;
	} else {
		this->numThreads = 1;
	}
	
	return;
}

bool WorkerLss::isDebug(void){
	return this->debug;
}

void WorkerLss::setDebug(bool debug){
	this->debug = debug;
	
	return;
}

int WorkerLss::startLss(void){
	rmatrix a, b, sliceR1, sliceD, sliceR2temp;
	
	IminusAB(sliceR1, a, this->getRank(), this->getNumThreads());
	
	calculateDR2temp(sliceR1, sliceD, sliceR2temp, this->getRank(), this->getNumThreads());
	
	IminusABminusCB(sliceD, sliceR2temp, a, this->getRank(), this->getNumThreads());
		
	return 0;
}
